package com.banyiyi.simple.http;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


/**
 * @ClassName Web
 * @Description TODO
 * @Author yangwm
 * @Date 2023/3/27 16:51
 * @Version 1.0
 */
@RestController
@RequestMapping(value = "/api/v1/websocket")
public class WebSocketController {

    @Autowired
    private WebSocketServer webSocketServer;

    @RequestMapping(value = "/sendTestMessage", method = RequestMethod.GET)
    public String sendTestMessage(String message) {
        try {
            webSocketServer.sendAllMessage(message);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }
}
